package 归并排序;

import java.util.Scanner;

public class Main {
    static int N = 100010, n;
    static int[] a = new int[N];
    static int[] tmp = new int[N];

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        for (int i = 0; i < n; i++) {
            a[i] = in.nextInt();
        }
        msort(0, n - 1);
        for (int i = 0; i < n; i++) {
            System.out.print(a[i] + " ");
        }
    }

    private static void msort(int l, int r) {
        if (l >= r) {
            return;
        }
        int mid = l + r >> 1;
        msort(l, mid);
        msort(mid + 1, r);
        int i = l, j = mid + 1, k = 0;
        while (i <= mid && j <= r) {
            if (a[i] < a[j]) {
                tmp[k++] = a[i++];
            } else {
                tmp[k++] = a[j++];
            }
        }
        while (i <= mid) {
            tmp[k++] = a[i++];
        }
        while (j <= r) {
            tmp[k++] = a[j++];
        }
        for (int m = 0; m < r - l + 1; m++) {
            a[m + l] = tmp[m];
        }
    }
}
